<?php
namespace Mobile\Controller;
use Think\Controller;
use Common\Model\Movie;
class CinemaController extends BaseController {
    public function detail(){
        $model=M('movie');
        $id=$_GET['id'];
        $list=$model->where("id=".$id)->find();
        $list['tags']= Movie::tagsAlias($list['tags']);
        $list['cover']='/Public/upload/'.substr($list['cover'],0,4).'/'.substr($list['cover'],4,2).'/'.substr($list['cover'],6,2).'/96_'.$list['cover'];
        $this->assign('data',$list);
        $cmodel=M('comment')->select();
        foreach($cmodel as $key => $value){
            $omdel=M('order')->where('id='.$value['order_id'].' and movie_id='.$id)->select();
            if(!empty($omdel)){
                $carr[$key]['id']=$omdel[0]['id'];
            }
        }
        foreach($carr as $key => $val){
            $ww=M('comment')->where(['order_id'=>$val['id'],'status'=>0])->select();
            $pmodel[$key]=$ww[0];
        }

        foreach($pmodel as $key => $va){
            $mm=M('member')->field('mobile')->where(['id'=>$va['mid']])->select();
            $pmodel[$key]['mname']=$mm[0]['mobile'];
        }
        $this->assign('pmodel',$pmodel);
        $this->display();
    }
}